<div id="results">
    <div class="content">
        <div class="content-directory">
            <p class="title f-w-m">
                名录<span class="f-w-r">(每个名录最多仅展示10条匹配项)</span>
            </p>
            <ul class="content-items">
                @foreach($directories as $key => $result)
                    <li>
                        <p>
                            <span class="f-w-m content-item-name">{{$result['label']}}</span>
                            <span class="f-w-r content-item-toast">结果数量：{{count($result['data'])}}<i
                                    class="i-content-arraw"></i></span>
                        </p>
                        <div class="content-item" style="display: none;">
                            <table class="content-item-lists directory">
                                <tr>
                                    <th>序号</th>
                                    <th>CAS号</th>
                                    <th>CN</th>
                                    <th>EN</th>
                                    <th>操作</th>
                                </tr>
                                @foreach($result['data'] as $material)
                                    <tr>
                                        <td>{{$material['sn'] ?? ''}}</td>
                                        <td>{{$material['cas'] ?? ''}}</td>
                                        <td>{{$material['name_zh'] ?? ''}}</td>
                                        <td>{{$material['name_en'] ?? ''}}</td>
                                        <td>
                                            <a href="{{route('material-report', ['key'=>$key, 'id'=>$material['id']])}}">详情</a>
                                        </td>
                                    </tr>
                                @endforeach
                            </table>
                        </div>
                    </li>
                @endforeach()
            </ul>
        </div>
        <div class="content-material">
            <p class="title f-w-m">新原料</p>
            <ul class="content-items">
                @foreach($newMaterials as $newMaterial)
                    <li>
                        <p>
                            <span class="f-w-m content-item-name">{{$newMaterial['label']}}</span>
                            <span class="f-w-r content-item-toast">结果数量：{{count($newMaterial['data'])}}<i
                                    class="i-content-arraw"></i></span>
                        </p>
                        <div class="content-item" style="display: none;">
                            <table class="content-item-lists material">
                                <tr>
                                    <th> CAS号</th>
                                    <th> 原料名称</th>
                                    <th> 中文名称</th>
                                    <th> 英文名称</th>
                                    <th> 批准机构</th>
                                    <th> 使用目的</th>
                                    <th> 使用范围</th>
                                    <th> 最大浓度</th>
                                    <th> 备注</th>
                                </tr>
                                @foreach($newMaterial['data'] as $newMaterialData)
                                    <tr>
                                        <td>{{$newMaterialData['cas'] ?? ''}}</td>
                                        <td>{{$newMaterialData['name'] ?? ''}}</td>
                                        <td>{{$newMaterialData['name_zh'] ?? ''}}</td>
                                        <td>{{$newMaterialData['name_en'] ?? ''}}</td>
                                        <td>
                                            {{$newMaterialData['approve_org'] ?? ''}}
                                            @if(!empty($newMaterialData['link']))
                                                <br><a href="{{$newMaterialData['link']}}">查看原文</a>
                                            @endif
                                        </td>
                                        <td>{{$newMaterialData['purpose'] ?? ''}}</td>
                                        <td>{{$newMaterialData['range'] ?? ''}}</td>
                                        <td>{{$newMaterialData['maximum_concentration'] ?? ''}}</td>
                                        <td>{{$newMaterialData['note'] ?? ''}}</td>
                                    </tr>
                                @endforeach
                            </table>
                        </div>
                    </li>
                @endforeach
            </ul>
        </div>
    </div>
</div>
